package alg20241204;

import java.util.Scanner;

public class Text {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int sum = in.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = in.nextInt();
        }
        //1 创建表
        int[][] dp = new int[n + 1][sum + 1];
        //2 初始化
        for (int i = 0; i <= n; i++) {
            dp[i][0] = 1;
        }
        //3 填表
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= sum; j++) {
                dp[i][j] += dp[i - 1][j];
                if(j >= nums[i - 1]){
                    dp[i][j] += dp[i - 1][j - nums[i - 1]];
                }
            }
        }
        //4 返回值
        System.out.println(dp[n][sum]);
    }
}
